<!DOCTYPE html>
<html lang="en">
<head>
<title>地市标识管理</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../../layui/css/layui.css" rel="stylesheet" type="text/css">
<link href="../../css/style.css" rel="stylesheet" type="text/css">
<script src="../../layui/layui.js"></script>
<script src="../../js/jquery-1.8.3.js"></script>
<script src="../../js/util.js"></script>
<script type="text/javascript">

        layui.use(['layer', 'table', 'form', 'jquery', 'element'], function () {
            var table = layui.table;
            var layer = layui.layer;
            var form = layui.form;
            var $ = layui.$;
 			var user;
            var option = {
                elem: "#table",//表格id
                id: "modelReload", //id
                url: '/citySign/find',
                method: 'post',
                request: {
                    pageName: 'page',
                    limitName: 'limit'
                },
                response: {
                    statusName: 'code',
                    statusCode: 0,
                    msgName: 'msg',
                    countName: 'count',
                    dataName: 'data'
                },
                page: true,
                count: "count",
                limit: 10,
                limits: [10, 20, 30, 40, 50],
                layout: ['prev', 'page', 'next'],
                prev: "上一页",
                next: "下一页",
                cols: [[ //表头
                    {field: 'cityName', title: '地市',align:'center'},
                    {field: 'signValue', title: '标识',align:'center'},
                    {field: 'operation', title: '操作',align:'center', toolbar: '#barDemo'}
                ]]
            };
            table.render(option);

            $('#query').on('click', function () {
                var index = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                var cityId = $("#cityId").val();
                var signId = $("input[name='sign']:checked").val();
                table.reload('modelReload', {
                    method: 'post',
                    page: {
                        curr: 1
                    },
                    where: {
                        cityId: cityId,
                        signId: signId
                    }
                });
                layer.close(index);
            });


            table.on('tool(table)', function (obj) {
                       var data = obj.data;
                        layer.confirm('您确定要修改吗？', {icon: 3, title: '提示'}, function (index) {
                            var url = "/citySign/modify";
                            var cityId = data.cityId;
                            var signId = data.signId;
                            if(signId=='1'){
                            	signId='2';
                            }else if(signId=='2'){
                            	signId='1';
                            }
                            var param={
                            	cityId:cityId,
                            	signId:signId
                            }
                            $.ajax({
                                type: 'post',
                                data: param,
                                url: url,
                                beforeSend: function () {
                                },
                                success: function (data) {
                                    if (data == 1) {
                                        layer.confirm('修改成功', {
                                            btn: ['确认'] //按钮
                                        }, function () {
                                            location.reload();
                                        });
                                    }
                                    else {
                                        layer.msg(json.data.msg);
                                    }
                                },
                                complete: function () {
                                }
                            });
                        });
                    });
        });


    </script>
<script type="text/html" id="barDemo">
        <a href="#" lay-event="modify">修改</a>&nbsp;
    </script>
</head>
<body>
	<div class="layui-content-body">
		<div class="scroll-box">
			<div class="breadcrumb-box">
				<span class="layui-breadcrumb" lay-separator="|"> <a
					href="javascript:returnIndex2()">首页&nbsp;</a> <a href="">系统管理</a> <a
					href=""> 地市标识管理</a>
				</span>
			</div>
			<div class="content-box">
				<div class="form-select-box">
					<div class="layui-form layui-form-pane" id="form">
						<div class="layui-form-item">
							<div class="layui-inline cityId">
								<label class="layui-form-label">地市</label>
								<div class="layui-input-block" style="width:120px;">
									<select name="cityId" lay-filter="cityId" id="cityId">
										<option value="">全部</option>
										<option value="11">苏州</option>
										<option value="12">淮安</option>
										<option value="13">宿迁</option>
										<option value="14">南京</option>
										<option value="15">连云港</option>
										<option value="16">徐州</option>
										<option value="17">常州</option>
										<option value="18">镇江</option>
										<option value="19">无锡</option>
										<option value="20">南通</option>
										<option value="21">泰州</option>
										<option value="22">盐城</option>
										<option value="23">扬州</option>
										<option value="25">省级</option>
									</select>
								</div>
							</div>
							<div class="layui-inline sign">
								<label class="layui-form-label" style="width:120px">标识</label>
								<div class="layui-input-block" style="width:300px;">
									<input class="radioItem" lay-filter="gis" type="radio"
										name="sign" title="全部" onclick="ChooseRadio(this)" value="0"
										checked="checked"> <input class="radioItem"
										lay-filter="gis" type="radio" name="sign" title="良好"
										onclick="ChooseRadio(this)" value="1"> <input
										class="radioItem" lay-filter="gis" type="radio" name="sign"
										title="欠费" onclick="ChooseRadio(this)" value="2">
								</div>
							</div>
							<div class="layui-inline">
								<button class="layui-btn layui-btn-normal" id="query">查&nbsp;询</button>
							</div>
						</div>
					</div>
				</div>
				<!--表格-->
				<div class="layui-table">
					<table id="table" lay-filter="table"></table>
				</div>
			</div>
		</div>
	</div>
	</div>
</body>
</html>